package com.xiang.sql.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.xiang.api.Util;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 转账 数据实体
 * 
 * @author mac-xiang
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "`transfer`", autoResultMap = true)
@ApiModel(value = "转账 对象", description = "转账")
public class Transfer implements Serializable {

  private static final long serialVersionUID = 1L;
  /** 主键ID */
  @TableId(value = "id", type = IdType.ASSIGN_ID)
  public String id;

  /** 创建时间 */
  @TableField(value = "`create_time`", fill = FieldFill.INSERT)
  public Long createTime;

  /** 类型 */
  @TableField(value = "`type`", fill = FieldFill.INSERT)
  public String type;

  /** 状态 */
  @TableField(value = "`state`", fill = FieldFill.INSERT)
  public String state;

  /** 金额 */
  @TableField(value = "`money`", fill = FieldFill.INSERT)
  public Long money;

  /** 订单编号 */
  @TableField(value = "`oid`", fill = FieldFill.INSERT)
  public String oid;

  /** 用户id */
  @TableField(value = "`create`", fill = FieldFill.INSERT)
  public String create;

  /** 发起人id */
  @TableField(value = "`cuid`", fill = FieldFill.INSERT)
  public String cuid;

  /** 名称 */
  @TableField(value = "`name`", fill = FieldFill.INSERT)
  public String name;

  /** 说明 */
  @TableField(value = "`des`", fill = FieldFill.INSERT)
  public String des;

  public Transfer() {
  }

  public Transfer(String type, long money, String oid, String create, String name, String des) {
    this.id = Util.sGetId();
    this.createTime = Util.time();
    this.type = type;
    this.money = money;
    this.oid = oid;
    this.create = create;
    this.name = String.format("%s: %s", type, name);
    this.des = des;
  }

}